package com.msw.jcwapi.dx.dxfb.controller;

import com.msw.jcwapi.common.result.Result;
import com.msw.jcwapi.dx.dxfb.entity.Dxfb;
import com.msw.jcwapi.dx.dxfb.service.impl.DxfbServiceImpl;
import com.msw.jcwapi.wb.wbdz.entity.Wbdz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2025-04-27
 */
@RestController
@RequestMapping("/dxfb")
public class DxfbController {

    @Autowired
    DxfbServiceImpl dxfbService;

    //查询全部吊弦
    @GetMapping("/list")
    public Result list(){
        return Result.ok(dxfbService.list());
    }

    //通过dxid删除该信息
    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable Integer id) {
        return Result.ok(dxfbService.deleteById(id));
    }

    //添加
    @PostMapping
    public Result save(@RequestBody Dxfb dxfb){
        return Result.ok(dxfbService.save(dxfb));
    }

    //编辑(通过dxid编辑)
    @PutMapping
    public Result update(@RequestBody Dxfb dxfb){
        return  Result.ok(dxfbService.update(dxfb));
    }

    //通过dxid查询全部信息
    @GetMapping("/listByDxId/{id}")
    public Result listByDxId(@PathVariable Integer id) {
        return Result.ok(dxfbService.listByDxId(id));
    }

}
